package com.kaibes.platform.article.db.entity;

import java.math.BigInteger;
import java.time.LocalDateTime;

import javax.validation.constraints.Min;

import com.kaibes.core.base.annotation.Description;
import com.kaibes.core.validator.NotBlankButNull;

import lombok.Data;

/**
CREATE TABLE `article_comment` (
  `id` BIGINT NOT NULL AUTO_INCREMENT,
  `content` TEXT,
  `user_id` INTEGER DEFAULT NULL,
  `article_id` BIGINT DEFAULT NULL,
  `comment_id` BIGINT DEFAULT NULL,
  `create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `article_id` (`article_id`),
  KEY `comment_id` (`comment_id`),
  FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE SET NULL,
  FOREIGN KEY (`article_id`) REFERENCES `article` (`id`) ON DELETE CASCADE,
  FOREIGN KEY (`comment_id`) REFERENCES `article_comment` (`id`) ON DELETE CASCADE
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
 */
@Data
@Description("文章评论")
public class ArticleComment {

    @Description("评论ID")
    private BigInteger id;
    @Description("评论内容")
    @NotBlankButNull(message = "内容不能为空")
    private String content;
    @Description("评论作者")
    @Min(1)
    private Integer userId;
    @Description("文章ID")
    @Min(1)
    private BigInteger articleId;
    @Description("被评论ID")
    private BigInteger commentId;
    @Description("创建时间")
    private LocalDateTime createTime;
    
}
